DEF_PROJECT=../../..
include $(DEF_PROJECT)/scripts/main.mk
name=psmisc
version=22.20
prefix=/usr
destdir=$(DIR_SYSROOT)
deps=ncurses
extdeps=eglibc-tools gcc-tools binutils-tools linux-header-tools

DL_SERV=http
DL_HOST=nchc.dl.sourceforge.net
DL_PATH=project/$(name)/$(name)
DL_SUFFIX=tar.gz

CFLAGS+=-I$(destdir)/usr/include

LDFLAGS+=-L$(destdir)/usr/lib

cflags+=--host=$(CC_TARGET)
cflags+=--build=$(CC_HOST)
cflags+=--exec-prefix=""
cflags+=--cache-file=$(DEF_CACHE)

pre-build:
	echo ac_cv_func_malloc_0_nonnull=yes >$(source)/$(DEF_CACHE)
	echo ac_cv_func_realloc_0_nonnull=yes >>$(source)/$(DEF_CACHE)
	cd $<;$(cdefs) ./configure $(cflags)

post-build:
	$(MAKE) -C $(if $(build),$(build),$(source)) $(iflags)
	mv -v $(destdir)/bin/pstree* $(destdir)/usr/bin
	ln -sfv killall $(destdir)/bin/pidof
